using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace A_stain_on_the_planet
{
    class Algen
    {
        Vector2 m_Position;
        FishLevel m_Level;
        FishLevelSurvival m_LevelSurvival;
        int m_Frameteller;
        Vector2 m_AlgenFrame;
        Texture2D m_Tex;
        BoundingBox m_Colision;

        public Algen(FishLevel level, Vector2 Position, Texture2D texture)
        {
            m_Level = level;
            m_Position = Position;
            m_Tex = texture;
            m_AlgenFrame.X = 0;
            m_AlgenFrame.Y = 0;
            m_Colision = new BoundingBox(new Vector3(m_Position.X, m_Position.Y, 0), new Vector3(41, 38, 0));
        }

        public Algen(FishLevelSurvival level, Vector2 Position, Texture2D texture)
        {
            m_LevelSurvival = level;
            m_Position = Position;
            m_Tex = texture;
            m_AlgenFrame.X = 0;
            m_AlgenFrame.Y = 0;
            m_Colision = new BoundingBox(new Vector3(m_Position.X, m_Position.Y, 0), new Vector3(41, 38, 0));
        }

        public void update()
        {
            ++m_Frameteller;
            if (m_Frameteller >= 5)
            {
                ++m_AlgenFrame.X;
                if (m_AlgenFrame.X >= 5)
                {
                    m_AlgenFrame.X = 0;
                    ++m_AlgenFrame.Y;
                    if (m_AlgenFrame.Y >= 5) m_AlgenFrame.Y = 0;
                }

            }
            m_Position.Y -= 2;

            m_Colision.Min.X = m_Position.X;
            m_Colision.Max.X = m_Position.X + 41;

            m_Colision.Min.Y = m_Position.Y;
            m_Colision.Max.Y = m_Position.Y + 38;
        }

        public Vector2 Position
        {
            get { return m_Position; }
            set { m_Position = value; }
        }

        public BoundingBox ColisionBox
        {
            get { return m_Colision; }
            set { m_Colision = value; }
        }

        public void Draw(GameTime gametime, SpriteBatch spritebatch)
        {
            spritebatch.Draw(m_Tex, new Rectangle((int)m_Position.X, (int)m_Position.Y, 41, 38), new Rectangle((int)m_AlgenFrame.X * 41, (int)m_AlgenFrame.Y * 38, 41, 38), Color.White);
        }
    }
}
